Page({
  data: {
    item: [], 
  },

  onLoad: function(options) {
    const itemId = options.itemId; 
    this.getItemFromStorage(itemId); 
  },

  getItemFromStorage: function(itemId) {
    try {
      
      const collectedItems = wx.getStorageSync('collectedItems') || [];

      
      const item = collectedItems.find(i => i._id === itemId); 

      
      this.setData({
        item: item || null 
      });

    } catch (e) {
      console.error("获取缓存数据失败", e);
    }
  },
});
